/*----------------------------------------------------------------------------
Owner(s): Shane Whitfield
$Copyright: $
$Id: 

Purpose  : game running
----------------------------------------------------------------------------*/

#pragma once

#include "subsystem.h"
#include "singleton.h"

/*--------------------------------------------------------------------------*/
// Class CEngine declaration.
class CEngine : public TSingleton <CEngine>, public CSubsystem
{
	typedef CSubsystem super;
	
public:
				CEngine();
				
	void		SystemMessage(const char* title, const char* message, const char* acceptString, const char* cancelString);
	bool		IsSystemMessageShowing()const;
			
	static void	SetSystemMessage(void (*systemMessage)(const char* title, const char* message, const char* acceptString, const char* cancelString));
	static void	SetSystemMessageShowing(bool (*systemMessageShowing)());
			
	void		Update(float dt);
	void		Render();
	void		Release();
#if DEBUG
	void		NNCommand(const char* i_commandTakerName, const char* i_commandFunction, const char* i_parameters);
#endif //DEBUG
	void		RequestIntro() {
					m_isIntroRequested = true; }
	bool		IsInGameState() const {
					return m_state == EState_Running; }
		
private:

	enum EState
	{
		EState_SettingUp,
		EState_Intro,
		EState_Map,
		
		EState_PreLoad,
		EState_Load,
		EState_PostLoad,
		EState_Running,
		EState_PreUnload,
		EState_Unload,
		EState_PostUnload,
	};

	void	init();
	void	setState(EState i_state);
	
	EState	m_state;
	bool	m_isIntroRequested;
};

inline CEngine& CEngine_GetSingleton() { return CEngine::GetSingleton(); }
#define g_engine (CEngine_GetSingleton())

/*-----------------------------------EOF!-----------------------------------*/